
<link rel="stylesheet" href="jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" href="jquery/easyui/themes/icon.css">
<body>
<div style="width: 100%;height: 87%">
    <table id="easyui_datagrid_select_temp" style="border:1px solid blue" >

    </table>
    <input type='checkbox' id='showadmin' onclick="showadmin(this)">
    <span style='font-size:5px'>显示公用模版</span>
</div>


<script src="https://upload.shinehao.com.cn/20180816150739jquery-1.8.3.min.js"></script>
<script src="https://upload.shinehao.com.cn/20180816145716jquery.easyui.min.js"></script>
<script src="https://upload.shinehao.com.cn/20180816151727easyui-lang-zh_CN.js"></script>
<script>

var type = window.parent.getMyUrlQueryString(window.location.href,"type");
var showAdmin=0;
function showadmin(){
	if($("#showadmin").is(":checked")){
		showAdmin=1
	}else{
		showAdmin=0;
	}
	$('#easyui_datagrid_select_temp').combogrid("grid").datagrid("reload", {
        'type':type,
        'showAdmin':showAdmin,
        'q':$('#easyui_datagrid_select_temp').combogrid("getValue")
    });
}
$(function(){
	
    $("body").bind("click",function(){
        $('#easyui_datagrid_select_temp').combogrid("showPanel");
    })
    $('#easyui_datagrid_select_temp').combogrid({
        mode:"remote",
        url:window.parent.serverUrl+"/createOrder/getTempList",
        queryParams: {
            type:type,
            showAdmin:showAdmin
        },
        idField: 'id',
        textField: 'temp_name',
        columns:[[
            {field:'id',title:'id'},
            {field:'temp_name',title:'模版名称',width:300,align:"center"},
        ]],
        height:"10%",
        width:"70%",
        panelWidth:"100%",
        panelHeight:"88%",
        //rownumbers:true,
        //fitColumns:true,
        pagination:false,
        loadMsg:"加载中,请等待...",
        singleSelect:true,
        align:"center",
        //toolbar: '#easyui_datagrid_source_fac_tool',
        loadFilter: function(data){
          return data.data;  
        },
        keyHandler: {
            enter: function(e){
            },
            query: function (q) {
                $('#easyui_datagrid_select_temp').combogrid("grid").datagrid("reload", {
                    'q': q,
                    'type':type,
                    'showAdmin':showAdmin
                });
                $('#easyui_datagrid_select_temp').combogrid("setValue",q);
            },
            up: function (e) {
                
            },
            down: function (e) {
                
            }
        },
        onLoadSuccess:function(data){
            if(data.total > 0) {
                $("input[type='text']").focus();
                return;
            }  
            //$(this).datagrid('appendRow', { color: '<div style="text-align:center;color:red">没有相关记录！</div>' }).datagrid('mergeCells', { index: 0, field: 'color', colspan: 3});  
            $("input[type='text']").focus();
            $('#easyui_datagrid_select_temp').combogrid("showPanel");
        },
        /*onSelect:function(index,row){
            console.info(row);
            var self = $(window.parent.document).find("["+dom.split(":")[0]+"='"+dom.split(":")[1]+"']");
            //console.info("myid:"+$(self).attr("myid")+":"+$(self).length+":"+"'"+dom.split(":")[0]+"'");
            //console.info("id:"+$(self).attr("id")+":"+$(self).length+":"+"'"+dom.split(":")[0]+"'");
            //console.info($(self).attr("'"+dom.split(":")[0]+"'"));
            //物料代码 色号 颜色描述 规格 填充
            
            $("input[type='text']").focus();
            $('#easyui_datagrid_source_fac').combogrid("showPanel");
        },*/
        onClickRow:function(index,row){
            console.info(row);
            $("input[type='text']").focus();
            $('#easyui_datagrid_select_temp').combogrid("showPanel");
            if(type==1){//订单模版
            	window.parent.basic_index.getTemp(row.id);
            	window.parent.basic_index.destroydialog();
            }
            if(type==2){//流程卡模版
            	window.parent.basic_index_card.getTemp(row.id);
            	window.parent.basic_index_card.destroydialog();
            }
        }
    });
    $('#easyui_datagrid_select_temp').combogrid("showPanel");
    $("input[type='text']").focus();
})
</script>
</body>


























